<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.css" rel="stylesheet" />
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
	
		<div class="mui-content" style="margin: 0 auto;">
			<div class="" style="text-align: center; font-size: large;margin-top: 50px;">
				用户列表
				<ul class="mui-table-view" id="userlist" style="text-align: left;background-color: rgb(239, 239, 244);" >
						<li v-for="user in users" class="mui-table-view-cell">
							账号：{{user.name}}  {{user.phone}}{{user.state}}金额：{{user.money}}{{user.lev}}{{user.limitcode}}
							<img v-bind:src="user.codeurl" >
							<input type="file" name="" id="" value="" />
							<div class="" style="margin-top: 20px;">
								<button type="button" v-on:click="upload" class="mui-btn mui-btn-blue " style="margin-right: 10px;">升级</button>
								<button type="button" v-on:click="upload" class="mui-btn mui-btn-blue " style="margin-right: 10px;">上传辅助码</button>
								<button type="button" v-on:click="over(user.id)" class="mui-btn mui-btn-blue " style="margin-right: 10px;">完成辅助验证</button>
								<button type="button" v-on:click="over(user.id)" class="mui-btn mui-btn-blue " style="margin-right: 10px;">提现</button>
							</div>
						</li>
						
					</ul>
			</div>
			
			
		</div>
		<script src="js/mui.js"></script>
		<script type="text/javascript">
			(function($, doc) {

				// vm.users=[
				//       { name: '1' },
				//       { name: '2' },
				// 	  { name: '4' },
				//       { name: '3' }
				//     ]
				$.init({
					statusBarBackground: '#f7f7f7'
				 
				});
				$.plusReady(function(){
					var vm=new Vue({
					  el: '#userlist',
					  data: {
					    users: [
					      {id:"1",name:"12345678",state:1,money:2.32,codeurl:'fonts/logo.png'},
						  {id:"2",name:"12345678",state:2,money:2.32,codeurl:'fonts/logo.png'},
						   {id:"2",name:"12345678",state:2,money:2.32,codeurl:'fonts/logo.png'},
						    {id:"2",name:"12345678",state:2,money:2.32,codeurl:'fonts/logo.png'},
							
					    ]
					  },
					  methods:{
						  over: function(name){
							  console.log(name)
							  alert(name);
							  // $.ajax('http://192.168.1.3:8888/sys/user',{
							  // 	data:{
							  // 		state:2
							  // 	},
							  // 	dataType:'json',//服务器返回json格式数据
							  // 	crossDomain:true,
							  // 	type:'put',//HTTP请求类型
							  // 	timeout:10000,//超时时间设置为10秒；data
							  // 	headers:{'Content-Type':'application/json'},	              
							  // 	success:function(data){
							  // 		if(data.code==0){
						 //  var thisView = plus.webview.currentWebview().opener();
						 //   $.fire(thisView, 'refresh');
							  // 		}else{
							  // 			$.toast(data.msg)
							  // 		}
							  		
							  // 	},
							  // 	error:function(xhr,type,errorThrown){
							  // 		alert(type)
							  // 		//异常处理；
							  // 		console.log(type);
							  // 	}
							  // });
							  
						  },
						  upload:function(event){
							  console.log(JSON.stringify(event))
							 var myform = new FormData();
							  myform.append('file', $("#img")[0].files[0]);
							   myform.append('id', $("#id").val());
							   $.ajax('http://192.168.1.3:8888/sys/uploadcode',{
							  	data:myform,
								contentType: false,
								processData: false,
								async:false,
							  	dataType:'json',//服务器返回json格式数据
							  	crossDomain:true,
							  	type:'put',//HTTP请求类型
							  	timeout:10000,//超时时间设置为10秒；data
							  	headers:{'Content-Type':'application/json'},	              
							  	success:function(data){
							  		if(data.code==0){
										var thisView = plus.webview.currentWebview().opener();
										 $.fire(thisView, 'refresh');
							  		}else{
							  			$.toast(data.msg)
							  		}
									
							  	},
							  	error:function(xhr,type,errorThrown){
							  		alert(type)
							  		//异常处理；
							  		console.log(type);
							  	}
							  });
						  }
					  }
					})
					
				})
				
				  // fs.addEventListener('tap',function(){
					 //  console.log("刷新")
					 //  var thisView = plus.webview.currentWebview().opener();
					 //   $.fire(thisView, 'refresh');
				  // })
			}(mui, document));
			
		</script>
	</body>

</html>
